const app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    programId: '',
    positions: [
      '胸部', '腹部', '三头', '二头', '上背', '背阔', '下背', '臀部', '前腿', '后腿'
    ]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {
    const programId = wx.getStorageSync("programId");
    this.setData({
      programId
    });
  },
  selectPosition: function(e) {
    const positions = this.data.positions;
    const index = e.currentTarget.dataset.index;
    const selectPosition = positions[index];
    const pages = getCurrentPages();
    const courseTrainDetailPage = pages[pages.length - 2];
    const programId = this.data.programId;
    courseTrainDetailPage.addOnePosition(programId, selectPosition);
    wx.navigateBack({
      delta:1
    });
  }
})